{
netif_t *netif = (netif_t *)arg;
- /* Already disconnected? */
- if (!netif->irq)
- return;
-
- unbind_from_irqhandler(netif->irq, netif);
- netif->irq = 0;
-
+ if (netif->irq)
+ unbind_from_irqhandler(netif->irq, netif);
+
unregister_netdev(netif->dev);
if (netif->tx.sring) {
#endif
}
-int netif_disconnect(netif_t *netif)
+void netif_disconnect(netif_t *netif)
{
-
- if (netif->status == CONNECTED) {
+ switch (netif->status) {
+ case CONNECTED:
rtnl_lock();
netif->status = DISCONNECTING;
wmb();
__netif_down(netif);
rtnl_unlock();
netif_put(netif);
- return 0; /* Caller should not send response message. */
+ break;
+ case DISCONNECTED:
+ BUG_ON(atomic_read(&netif->refcnt) != 0);
+ free_netif(netif);
+ break;
+ default:
+ BUG();
}
-
- return 1;
}
/*